import React from 'react'
import { View } from '@tarojs/components'
import { useRouter} from '@tarojs/taro'
import { arrayToObject } from '@/utils/utils';
import { OTHER_ID, compInstrumentOptions, joinTypeOptions, genderOptions, compCatOptions, enrollOptions, instruments, singleExperGroupOptions } from '@/utils/applyEnum';

import './index.scss'

function Index(){
  const router = useRouter();
  const address = JSON.parse(router?.params?.query);


  console.log(address, 'address');
  const list = singleExperGroupOptions.filter(v => v.catId === address?.compCat);
  console.log(JSON.parse(address?.groupRegisters), 'list');

  return (
    <View className='xxm-address-detail'>
      <View className='card'>
        <View className='form-group'>
          <View className='label'>
            参赛者姓名：
          </View>
          <View>{address?.registerName}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
           参赛者身份证：
          </View>
          <View>{address?.idNo}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            活动名称：
          </View>
          <View>{address?.activity?.name}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            报名费用：
          </View>
          <View>{address?.order?.all_price / 100}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            比赛方式：
          </View>
          <View>{arrayToObject(joinTypeOptions)[address?.joinType]}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            比赛项目：
          </View>
          <View>{arrayToObject(compCatOptions)[address?.compInstrumentCat]}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            比赛乐器：
          </View>
          <View>{arrayToObject(instruments)[address?.compInstrument]}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            参赛者手机号：
          </View>
          <View>{address?.telNo}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            比赛组别：
          </View>
          <View>{arrayToObject(compCatOptions)[address?.compCat]}</View>
        </View>
        {[1, 2].includes(address?.compCat) && (
          <View className='form-group'>
            <View className='label'>{compCatOptions[address?.compCat - 1].label}-比赛组别</View>
            <View className='content'>{arrayToObject(singleExperGroupOptions.filter(v => v.catId === address?.compCat))?.[address?.compSubCat]}</View>
          </View>
        )}
        {
          [3, 4].includes(address?.compCat) && 
          <View className='form-group'>
              <View className='form-group-contnt'>
                <View className='form-item'>
                  <View className='label'>
                    组合成员信息：
                  </View>
                  <View className='item_subtitle'>（含负责报名的代表成员信息）</View>
                </View>
                <View className='form-content'>
                  {
                    JSON.parse(address?.groupRegisters).map(it => (
                      <View className='item_line'><View>姓名：{it.name}</View>
                      <View className='item_pos'>乐器：{it.posi}</View></View>
                    ))
                  }
                </View>
              </View>
          </View>
        }
        
        <View className='form-group'>
          <View className='label'>
            参赛曲目：
          </View>
          <View>{address?.compRepertoire}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            指导教师姓名：
          </View>
          <View>{address?.instructTeacherName}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            指导教师联系电话：
          </View>
          <View>{address?.instructTeacherTelNo}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            报名方式：
          </View>
          <View>{arrayToObject(enrollOptions)[address?.enrollType]}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            收件人地址：
          </View>
          <View>{address?.addressDetail}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            团体报名证书收件老师姓名：
          </View>
          <View>{address?.addrName}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            团体报名证书收件老师电话
          </View>
          <View>{address?.addrTelNo}</View>
        </View>
        <View className='form-group'>
          <View className='label'>
            艺术机构/培训学校/工作室/艺术院校 ：
          </View>
          <View>{address?.school}</View>
        </View>
        
      </View>
    </View>
  )
}
export default Index
